Setting up automatic versioning
Conventional commits​
We use conventional commits to automatically generate release notes and version numbers. This can in turn be used to automatically create releases in github. In the next section we will go through how to set this up.
Check out the getting started page for more information.
Setting up automatic versioning​
Setting up the automatic versioning requires some setup in the github repo:
- Set workflow permissions to "Read and write permissions"
under
https://github.com/gjensidige/your-repo-name/settings/actions - Give the gjensidige-bot the
writerole inhttps://github.com/gjensidige/your-repo-name/settings/access - Add
ACTIONS_SYSTEM_USERto the repo using the github slack bot if it's not already added - Copy the workflow file
pr-create-release.ymlto your workflows, from here - Add the
release.config.jsto your repo, defaults to using main as release branch, from here
Setting up python automatic versioning​
If you try to install a python package using pip, you might have run into issues of it not updating the package because it thinks it's already installed.
And according to pip it probably is, but you want it to update to the latest version. Pip uses the version number to determine if it should update the package or not.
Using the following steps you can set up automatic versioning for your python package based on the release tag which is created in the previous section.
- In your
mainbranch protection rules, enable "Allow specified actors to bypass required pull requests" and addgjensidige-botto the list,https://github.com/gjensidige/your-repo-name/settings/branch_protection_rules - Add the
update-versiongithub action to your repository from here - Add the
update_version.pyscript to the root of your repository from here
This assumes that you have a setup.cfg file in the root of your repository with a version number in it.